package com.ly.lypicturebackend.api.imageSearch;

import com.ly.lypicturebackend.api.imageSearch.model.ImageSearchResult;
import com.ly.lypicturebackend.api.imageSearch.sub.GetImageFirstUrlApi;
import com.ly.lypicturebackend.api.imageSearch.sub.GetImageListApi;
import com.ly.lypicturebackend.api.imageSearch.sub.GetImagePageUrlApi;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @author luyi
 * @create 2025-02-23-14:26
 */
@Slf4j
public class ImageSearchApiFacade {
    public static List<ImageSearchResult> searchImage(String imageUrl) {
        String pageUrl = GetImagePageUrlApi.getImagePageUrl(imageUrl);
        String imageFirstUrl = GetImageFirstUrlApi.getImageFirstUrl(pageUrl);
        return GetImageListApi.getImageList(imageFirstUrl);
    }

    public static void main(String[] args) {
        List<ImageSearchResult> imageSearchResults = ImageSearchApiFacade.searchImage("https://luyi-1331918949.cos.ap-shanghai.myqcloud.com//public/1872175600224530434/2025-01-02_XCOKYo6TtMhbBuQq.jpg");
        System.out.println(imageSearchResults);
    }
}
